std.os.linux.tls
: Refactor, improve documentation, fix a bug, and port to more architectures
#20857
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I don't normally like to propose refactors like this, but I think it's warranted here. I like to think I'm pretty good at understanding obscure ABI stuff, but I really struggled with this particular module initially. It's not helped by the fact that there's a lot of incorrect/incomplete information floating around on the internet. So, I renamed things to (hopefully) be more clear, added more in-depth (and correct) documentation, and replaced some pointer manipulation with a struct.
Once I understood the module, it became clearer that there was something off-looking about the layout computation for the modified Variant I. I verified that it was indeed broken by testing on PPC64, and also fixed that.
Finally, I ported the module to all the architectures I've been doing porting work for: